import axios  from 'axios'
//axios.defaults.baseURL = 'https://m.maizuo.com'

// 添加请求拦截器
axios.interceptors.request.use(function (config){
  let host = "mall.film-ticket.film.list"
  let info = config.headers.info
  if('cinema' == info){
    host = "mall.film-ticket.cinema.list"
  }else if('city' == info){
    // 城市列表信息请求头
    host = "mall.film-ticket.city.list"
  }
  config.headers = {
    "X-Client-Info":
      '{"a":"3000","ch":"1002","v":"5.0.4","e":"1598087896889693885431809","bc":"110100"}',
    "X-Host": host,
  }
  // 在发送请求时返回config
  return config
},function (error){
  // 对请求错误做什么
  return Promise.reject(error)
})

export default axios